<SCRIPT language="javascript" src="/{$#app_name}/include/zts_picker.js"></SCRIPT>
<script language="javascript">
// Gets a element by its Id. Used for shorter coding.
function GetE( elementId )
{
	return document.getElementById( elementId )  ;
}

function SetAttribute( element, attName, attValue )
{
	if ( attValue == null || attValue.length == 0 )
		element.removeAttribute( attName, 0 ) ;			// 0 : Case Insensitive
	else
		element.setAttribute( attName, attValue, 0 ) ;	// 0 : Case Insensitive
}
</script>


<script language="javascript">
    function showGameDateCalendar() {
        var day = document.ScoresForm.gameDay.value;
        var month = document.ScoresForm.gameMonth.selectedIndex;
        var year = document.ScoresForm.gameYear.value;
        var dt = new Date();
    	if (day>=1 && month>=1 && year>=2000) dt = new Date(year,month-1,day);
    	var str_dt = dt2dtstr(dt);
    	//alert(str_dt);
    	show_calendar('setGameDate',str_dt);
    }
	function setGameDate(str_dt) {
			//alert(str_dt);
			var dt_datetime = (str_dt == null || str_dt =="" ?  new Date() : str2dt(str_dt));
			var month = dt_datetime.getMonth()+1;
			//alert(month);
			var day = dt_datetime.getDate();
            var year = dt_datetime.getYear();
            //alert(day);
            document.ScoresForm.gameDay.value = day;
            document.ScoresForm.gameYear.value = year;
            document.ScoresForm.gameMonth.selectedIndex = month;
	}
</SCRIPT>



<form id="ScoresForm" name="ScoresForm" method="post" action="" runat="server">
<input name="scoreID" type="hidden" id="scoreID" runat="server">
<input name="page" type="hidden" id="page" runat="server">
<hr>
<core:optional for="msg">
	<span class="message" runat="server"> {$msg} </span>
</core:optional>
<table width="100%" border="0" align="center" cellspacing="2" cellpadding="3">
	<tr>
	<td colspan="4" class="textlogin" style="font-size:10pt;left-pedding:20;padding-bottom:5;">
		Note: Fields marked with asterick (<font color="red">*</font>) are obligatory
	</td>
	</tr>
    <tr align="left">
    	<td class="whiteheader_center"  colspan="2">
    		<core:optional for="scoreID">
    			Edit the Score (ID: {$scoreID})
            </core:optional>
            <core:default for="scoreID">
            	Create a new Score
            </core:default>
         </td>
         <td class="whiteheader" colspan="2">
            <a href="/{$#app_name}/myprofile/index.htm"> My Profile </a> &nbsp;
           	<html:link url="/">All scores </html:link>
          </td>
     </tr>

    <core:default for="supress_errors">
    <ERRORSUMMARY id='Summary' runat="server">
        <tr valign="top">
          <td width="{$#width}" colspan="1">Errors: &nbsp;</td>
          <td class="left" colspan="3">
          	<FONT COLOR="RED">
          		<list:ITEM> {$ErrorMessage} &nbsp; </list:ITEM>
          	</FONT>
          </td>
        </tr>
     </ERRORSUMMARY>
     </core:default>

     <tr>
     	<td class="small" colspan="4">
     		<core:optional for="scoreID">
     			Enter your changes to the information below to edit an existing content item.
     			When you are finished, press the Save button.
            </core:optional>
     	</td>
     </tr>




     <tr valign="top">
       <td class="form_label" width="{$#width}" colspan="1">
      	 <label for="title" runat="server"><font color="red">*</font>Game Name</label>
       </td>
       <td class="form_field" colspan="3">
         <input name="gameName" type="text" id="gameName" size="64" runat="server">
         <span class="small"> 112 characters limit </span>
       </td>
     </tr>

     <tr valign="top">
       <td class="form_label" width="{$#width}" colspan="1">
      	 <label for="seasonYear" runat="server">Season</label>
       </td>
       <td class="form_field" colspan="3">
      	 <select name='seasonYear' id='seasonYear' runat="server">
	 	 </select>
       </td>
     </tr>

     <tr valign="top">
       <td class="form_label" width="{$#width}">
      	 <label for="team1ID" runat="server">Team 1</label>
       </td>
       <td class="form_field">
      	 <select name='team1ID' id='team1ID' runat="server">
	 	 </select>
       </td>
       <td class="form_label" width="{$#width}">
      	 <label for="score1" runat="server">Score 1</label>
       </td>
       <td class="form_field">
      	 <input name="score1" type="text" id="score1" size="6" runat="server">
       </td>
     </tr>

     <tr valign="top">
       <td class="form_label" width="{$#width}">
      	 <label for="team2ID" runat="server">Team 2</label>
       </td>
       <td class="form_field">
      	 <select name='team2ID' id='team2ID' runat="server">
	 	 </select>
       </td>
       <td class="form_label" width="{$#width}">
      	 <label for="score2" runat="server">Score 2</label>
       </td>
       <td class="form_field">
      	 <input name="score2" type="text" id="score2" size="6" runat="server">
       </td>
     </tr>

     <tr valign="top">
       <td class="form_label" width="{$#width}" colspan="1">
      	 <label for="gameDate" runat="server">Game Date:</label>
       </td>
       <td class="form_field" colspan="3">
         <input name="gameDay" type="text" id="gameDay" size="2" runat="server">
         <select name="gameMonth" id="gameMonth" runat="server">
         </select>
         <input name="gameYear" type="text" id="gameYear" size="4" runat="server">
         <a href="javascript:showGameDateCalendar();">
           <img height=20  src="/{$#app_name}/images/calendar.gif" width=20 border=0 >
         </a>
       </td>
     </tr>

     <core:optional for="scoreID">
     <tr valign="top">
       <td class="form_label" width="{$#width}" colspan="1">
      	 <label for="date_added" runat="server">Date Posted:</label>
       </td>
       <td class="form_field" colspan="3">
         <span class="small"> {$date_added} </span>
       </td>
     </tr>

     </core:optional>


     <core:optional for="staff_user">
     <tr valign="top">
       <td class="form_label" width="{$#width}" colspan="1">
      	 <label for="enabled" runat="server">Enabled</label>
       </td>
       <td class="form_field" colspan="3">
         <input name="enabled" type="checkbox" id="enabled" value="1" checked="true" runat="server">
       </td>
     </tr>
     </core:optional>


     <tr>
      <td class="whiteheader_center" colspan="4">&nbsp;</td>
     </tr>

	 <tr>
      <td colspan="1">&nbsp;</td>
      <td class="form_field" colspan="3">

      		<core:default for="scoreID">
      			<input type="submit" name="create" value="Create" runat="server">
            </core:default>
            <core:optional for="scoreID">
      			<input type="submit" name="save" value="Save" runat="server">

            </core:optional>
            <input type="submit" name="clean" value="Clean" runat="server">
            <input type="submit" name="scores" value="Back to all scores" runat="server">

      </td>
</tr>

</table>
</form>

